package com.clean.notification.bean;


import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.widget.RemoteViews;

import com.clean.notification.R;
import com.clean.notification.app.BaseApplication;

/**
 * 常驻通知
 *
 * @author Admin
 */
public class ResidentNoticeConfig {

    public static int getPendingFlag() {
        return Build.VERSION.SDK_INT >= 23 ? 67108864 : 134217728;
    }


    public ResidentNoticeConfig() {
    }

    public static RemoteViews GreenOngoingRemoteView() {
        RemoteViews remoteViews = new RemoteViews(BaseApplication.mContext.getPackageName(), R.layout.noti_notification_layout);
        Intent intent = new Intent();
        intent.setComponent(new ComponentName(BaseApplication.mContext.getPackageName(), "com.clean.cleantotal.compores.start.StartActivity"));
        Bundle bundle = new Bundle();
        bundle.putString("from", "clean");

        intent.putExtras(bundle);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent cleanIntent = PendingIntent.getActivity(BaseApplication.mContext, 31, intent, getPendingFlag());
        remoteViews.setOnClickPendingIntent(R.id.cleanLayout, cleanIntent);
        Intent intent1 = new Intent();
        intent1.setComponent(new ComponentName(BaseApplication.mContext.getPackageName(), "com.clean.cleantotal.compores.start.StartActivity"));

        Bundle bundle1 = new Bundle();
        bundle1.putString("from", "process");
        intent1.putExtras(bundle1);

        intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        PendingIntent processIntent = PendingIntent.getActivity(BaseApplication.mContext, 32, intent1, getPendingFlag());

        remoteViews.setOnClickPendingIntent(R.id.processLayout, processIntent);
        Intent intent3 = new Intent();
        intent3.setComponent(new ComponentName(BaseApplication.mContext.getPackageName(), "com.clean.cleantotal.compores.start.StartActivity"));

        Bundle bundle3 = new Bundle();
        bundle3.putString("from", "battery");

        intent3.putExtras(bundle3);

        intent3.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent batteryIntent = PendingIntent.getActivity(BaseApplication.mContext, 34, intent3, getPendingFlag());

        remoteViews.setOnClickPendingIntent(R.id.batteryLayout, batteryIntent);
        Intent intent2 = new Intent();
        intent2.setComponent(new ComponentName(BaseApplication.mContext.getPackageName(), "com.clean.cleantotal.compores.start.StartActivity"));

        Bundle bundle2 = new Bundle();

        bundle2.putString("from", "device");
        intent2.putExtras(bundle2);

        intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent deviceIntent = PendingIntent.getActivity(BaseApplication.mContext, 33, intent2, getPendingFlag());
        remoteViews.setOnClickPendingIntent(R.id.deviceLayout, deviceIntent);
        return remoteViews;
    }


    public static RemoteViews GreenOngoingRemoteViewBig() {
        return GreenOngoingRemoteView();
    }
}
